package com.example.demo.web.manage.service;

import com.easy.query.api.proxy.client.EasyEntityQuery;
import com.easy.query.solon.annotation.Db;
import com.example.demo.web.manage.dto.DeptDto;
import com.example.demo.web.manage.model.DeptEntity;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.noear.solon.annotation.*;

/**
 * @author airhead
 */
@Component
@Slf4j
public class DeptService {
  @Db("db1")
  private EasyEntityQuery entityQuery;

  public List<DeptDto> listWithException() {
    throw new RuntimeException("返回特定的异常消息");
  }

  public List<DeptDto> list() {
    return entityQuery.queryable(DeptEntity.class).select(DeptDto.class).toList();
  }
}
